<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>地址</title>
    <script>
        console.log(location.protocol)
        console.log(location.hostname)
        console.log(location.port)
        console.log(location.pathname)
        console.log(location.search)
        console.log(location.hash)
        console.log(location.host)
        console.log(location.href)
        // location.hash='#a'
        // location.href="https://www.baidu.com"
    </script>
</head>
<body>
    <a href="#top">顶部</a>
    <form action="" >
        <input type="text" name="user">
        <input type="submit" >
    </form>
    <button onclick="location.reload()">刷新</button>
    <button onclick="location.assign('https://ys.mihoyo.com/')">跳转1</button>
    <button onclick="location.replace('https://www.baidu.com')">跳转2</button>
</body>
</html>